import request from '@/utils/ajax.js';

//1、用户登录-------------------------------
export const login_api = (data) => {
  return request({
    url: '/app/v1_0/authorizations',
    method: 'POST',
    data
  })
  // return request.get('/api/getlunbo')
};
//2、获取验证码----------------------------
export const codes_api = (mobile) => {
  return request.get('/app/v1_0/sms/codes/' + mobile)
};
//3、获取用户自己信息--------------------------------
export const getUserInfo_api = () => {
  return request.get('/app/v1_0/user')
};
//4、获取用户频道列表---------------------------
export const getChannelsList_api = () => {
  return request.get('/app/v1_0/user/channels')
}
//5、获取频道新闻数据-------------------------
export const getArticles_api = (params) => {
  return request({
    url: `/app/v1_1/articles`,
    method: 'get',
    params: {
      channel_id: params.channel_id,
      timestamp: params.timestamp,
      with_top: params.with_top
    }
  })
}
//6、获取全部频道列表-----------------------
export const getchannelsAll_api = () => {
  return request.get('/app/v1_0/channels')
}
//批量删除用户频道列表---------------------
export const delUserchannels_api = (id) => {
  return request({
    url: '/app/v1_0/user/channels/'+id,
    method: 'DELETE',
  })
}
//批量修改用户频道列表--------参数是数组---------------
export const addMyChannel_api=(channels)=> {
  return request({
    url:'/app/v1_0/user/channels',
    method:'patch',
    data:{
      channels
    }
  })
}
